﻿@using PAMD.Business.Models
@model ResetPasswordModel
@{
    ViewBag.Title = SiteConstant.Slogan;
    Layout = "../Shared/_Layout.cshtml";
}
<script type="text/javascript" language="javascript">

    $(document).ready(function (event) {

        $('#SaveButton').click(function () {

            var validated = ValidateForm();
            return validated;
        });
    });

    function ViewProfileClick() {
        window.location.href = '@Url.Action("Index", "Profile")';
    }

</script>
@using (Html.BeginForm("ChangePassword", "Profile"))
{
    <div class="form-container-small">
        <strong>Change account password In</strong>
        <fieldset class="field-container">
            @if (ViewBag.Error != null && ViewBag.Error != "")
            {
                <div class="red-box">
                    @ViewBag.Error
                    <br /> @Html.ActionLink("Forgot password?", "ForgotPassword", "Account")
                </div>
            }
            @if (ViewBag.Message != null && ViewBag.Message != "")
            {
                <div class="blue-box">
                    @ViewBag.Message
                </div>
                
                <div class="left-align">
                    <div class="controlBox">
                        <input type="button" id="ViewProfile" onclick="ViewProfileClick()" style="margin-left: 200px;"
                               value="View Profile" />
                    </div>
                </div>
            }
            else
            {                 
                <div class="left-align">
                    <div class="controlBox">
                        <label for="CurretPassword" style="width: 200px;">
                            Current password &nbsp;</label>
                        @Html.PasswordFor(m => m.CurretPassword, new { validation = "required,minmaxLenght,4,25", @class = "inputBox" })
                    </div>
                    <div id="CurretPassword_Error" class="error-box">
                        Please enter current password, Min 4 character.
                    </div>
                </div>
                <div class="left-align">
                    <div class="controlBox">
                        <label for="Password" style="width: 200px;">
                            New password &nbsp;</label>
                        @Html.PasswordFor(m => m.Password, new { validation = "required,match,minmaxLenght,4,25", @class = "inputBox" })
                    </div>
                    <div id="Password_Error" class="error-box">
                        Please enter password, Min 4 character.
                    </div>
                </div>
                <div class="left-align">
                    <div class="controlBox">
                        <label for="Password2" style="width: 200px;">
                            Confirm password &nbsp;</label>
                        @Html.Password("Password2", string.Empty, new { @class = "inputBox" })
                    </div>
                    <div id="Password_Match" class="error-box">
                        Password does not match the confirm password.
                    </div>
                </div>
                <div class="left-align">
                    <div class="controlBox">
                        <input type="submit" id="SaveButton" style="margin-left: 200px;" value="Change Password" />
                    </div>
                </div>
            }
        </fieldset>
    </div>
}